package com.ch.base.action;

import org.apache.log4j.Logger;

import com.ch.base.util.DateUtils;
import com.ch.base.util.StringUtils;
import com.opensymphony.xwork2.ActionSupport;

public class ErrorException extends ActionSupport {
	private final Logger log = Logger.getLogger(this.getClass());
	
	private String errorDateTime;
	private String errorMsg = "";
	private String errorSolution = "";

	public String execute() {
		errorDateTime = DateUtils.getSysTime("AD", "", true, "", true, true);
		errorMsg = StringUtils.isEmpty(errorMsg) ? "" : errorMsg;
		errorSolution = StringUtils.isEmpty(errorSolution) ? "請立即聯絡系統工程師，謝謝！造成您的不便，敬請見諒！" : errorSolution;
		return SUCCESS;
	}
	
	public String loginException() {
		errorDateTime = DateUtils.getSysTime("AD", "", true, "", true, true);
		errorMsg = "使用者資訊(session)未被建立或已遺失。";
		errorSolution = "請您重新登入，然後執行本作業功能即可。<br/>若重新登入後，仍無法執行本作業功能，請立即聯絡系統工程師，謝謝！<br/>造成您的不便，敬請見諒！";
		return SUCCESS;
	}

	public String getErrorDateTime() {
		return errorDateTime;
	}

	public void setErrorDateTime(String errorDateTime) {
		this.errorDateTime = errorDateTime;
	}

	public String getErrorMsg() {
		return errorMsg;
	}

	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}

	public String getErrorSolution() {
		return errorSolution;
	}

	public void setErrorSolution(String errorSolution) {
		this.errorSolution = errorSolution;
	}

}
